package day03.io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

/**
 * @ClassName OOSDemo
 * @Description TODO
 * @Author xinghaiyang
 * @Date 2023/3/19 16:29
 * @Version 1.0
 *
 * 对象输出流:高级流
 * 作用:将对象转换为一组字节,然后将字节写出到文件中
 **/
public class OOSDemo {
    public static void main(String[] args) throws IOException {
        String name = "苍老师";
        int age = 55;
        String gender = "男";
        String[] otherInfo = {"拍片技术一流","你们的技术启蒙老师","刘桑"};
        Person p = new Person(name,age,gender,otherInfo);
        FileOutputStream fos = new FileOutputStream("./person.obj");
        ObjectOutputStream oos = new ObjectOutputStream(fos);
        oos.writeObject(p);
        System.out.println("写出完毕");
        oos.close();
    }
}
